home *** CD-ROM | disk | FTP | other *** search
/ MIDICraft's MIDINET CD-ROM / MIDICraft's MIDINET CD-ROM.iso / DOSUTILS / MIDIFIX.DOC < prev    next >
Text File  |  1996-09-16  |  7KB  |  167 lines

  1.         ******************************
  2.             MIDIFIX v1.4
  3.     
  4.             fix midi structure errors 
  5.               by Guenter Nagler 
  6.                 1995 
  7.           (gnagler@ihm.tu-graz.ac.at)
  8.         ******************************
  9.  
  10. [1] BACKGROUND
  11. From writing utilities MIDI2TXT and TXT2MIDI  I got some knowledge
  12. of midi file format. Once a person on net searched for help on
  13. reviving a defect midi. I had a look at it and found that the note
  14. data seemed to be ok but the structure of the midi file was lost.
  15. The number of midi tracks and the length field of most tracks were 0.
  16. I measured the number of tracks and the length of each track and 
  17. edited the correct values with a binary hexadecimal editor into the 
  18. midifile. The file was totally rescued by very simple changes.
  19. I found that this simple operations could be done very quickly by a 
  20. small computer program.
  21.  
  22. [2] FILES DESCRIPTION
  23.  
  24. MIDIFIX.EXE..........MSDOS executable fixes structure bugs in midifiles
  25. MIDIFIX.DOC..........this file, showing usage of MIDIFIX.EXE
  26. MIDIFIX.CPP..........C/C++ source code for midifix (DOS/UNIX)
  27. only MIDIFIX.EXE is required to run program 
  28.  
  29. [3] COPYRIGHT
  30.  
  31. MIDIFIX (c) 1995 was created by Guenter Nagler.
  32.  
  33. MIDIFIX is free and may be used as you wish with this one exception:
  34.  
  35.     You may NOT charge any fee or derive any profit for distribution
  36.     of MIDIFIX.  Thus, you may NOT sell or bundle MIDIFIX with any 
  37.     product in a retail environment (shareware disk distribution, CD-ROM,
  38.     etc.) without permission of the author.
  39.  
  40. You may give MIDIFIX to your friends, upload it to a BBS, or ftp it to
  41. another internet site, as long as you don't charge anything for it.
  42.  
  43. [4] DISCLAIMER
  44.  
  45. MIDIFIX was designed to fix simple structure bugs in midifiles.
  46. It counts the number of tracks and updates the tracknumber field in header.
  47. It searches beginning and end of tracks and updates the tracklength field
  48. for each recognized track. 
  49.  
  50. MIDIFIX does not check the contents of a track.
  51.  
  52. Use MIDIFIX at your own risk.  Anything you do with MIDIFIX is your
  53. responsibility, and not the author's.  Any damage caused to any person,
  54. computer, software, hardware, company, or business by running MIDIFIX 
  55. is your responsibility, and the author will not be liable.
  56.  
  57. If you don't understand these terms, or are not sure of something, or
  58. are afraid something bad might come of using MIDIFIX, don't  use  it!
  59. You are here forewarned.
  60.  
  61. [5] INSTALLATION 
  62.  
  63. [MSDOS]
  64.  
  65.   Simply copy MIDIFIX.EXE in a directory that is in your path.
  66.   When you start the program without arguments
  67.  
  68.   C:\> MIDIFIX
  69.  
  70.   you should get the usage text (see next section)
  71.  
  72. [UNIX]
  73. compile sources with your C++ compiler (e.g. GNU Compiler g++):
  74.  
  75. g++ -o midifix midifix.cpp
  76.  
  77. and run program
  78.  
  79. $ midifix
  80.  
  81. [6] USAGE
  82.  
  83. usage: MIDIFIX [-tracksonly] filename.mid [result.mid]
  84. -tracksonly    check and repair only track headers
  85. if output filename is not given and changes are necessary then
  86. output will be written to midifix.mid
  87.  
  88. The parameters in brackets [...] are optional.
  89.  
  90. The program will comment all changes done to the file.
  91.  
  92. Warning: The result files are overwritten without warning!
  93.  
  94.  
  95. [7] OUTPUT MESSAGES
  96.  
  97.  * file.mid: not a midifile (missing MThd)
  98.    Maybe this file never intended to be of MIDI file format?
  99.    A MIDI file must begin with 4 characters MThd.
  100.    midifix searches in the source file for this header.
  101.   
  102.  * length of header updated
  103.    The length of a header is normally 6 bytes. For some reason
  104.    the length information does not match this value.
  105.  * length of track 1 updated
  106.    The length of a track did not match the number of bytes between
  107.    character sequence MTrk of track 1 and MTrk of track 2 or end of file.
  108.  * 1 track missing
  109.    the midi file is truncated and the original correct version of the file
  110.    contained 1 track more than now.
  111.  * 2 new tracks found
  112.    the midi file contains a too small track count value.
  113.  * number of tracks updated: 6
  114.    the number of tracks in trackcount field of header did not match the
  115.    number of tracks found in midifile (6 Tracks). 
  116.    The value 6 is written into trackcount field.
  117.  * remove garbage at end of midi (1 byte)
  118.    The midifile contained invalid characters at the end of the file.
  119.    Normally a midi player/sequencer should ignore these bytes but some
  120.    do not accept the midi files. The characters are removed from the file.
  121.  * removing incomplete midi command 
  122.    Warning: 2 bytes lost
  123.    When a track is truncated sometimes updating of track length does not
  124.    help. Commands that are incomplete are deleted at end of a track.
  125.    An end of track command is automatically added to track if last command
  126.    is not an end command.
  127.  * version 1 track contains different channel commands.
  128.    setting channel to 6
  129.    In a version 1 midi file the tracks should only contain midi commands 
  130.    that are of same channel (and optionally not channel depending commands).
  131.    The first channel depending command sets the channel of track.
  132.    (This could also be caused by missing bytes in midi file so that 
  133.    time values and commands are misinterpretated. Such errors cannot be 
  134.    fixed by midifix)
  135.    
  136. [8] SUGGESTIONS / COMMENTS / BUG REPORTS / QUESTIONS
  137.  
  138.          WWW:    http://hgiicm.tu-graz.ac.at/Cpub
  139.           contains all my dos/unix midi programs
  140.          EMAIL:  gnagler@ihm.tu-graz.ac.at
  141.  
  142. [9] CHANGES
  143. v1.0 to v1.1:
  144.   * removing garbage bytes (bytes behind end command of last track)
  145.   * minor changes of file io to increase unix compatibility.
  146. v1.1 to v1.2:
  147.   * writing result into new file (no changes are done in original file)
  148.   * checking midi commands (shows problems that cannot be repaired by midifix)
  149.   * removing truncated midi commands at end of tracks
  150.   * midi song searched in source file (does not need to be at beginning of file).
  151.     (that means:  *.rmi files and macintosh midi files can be corrected to
  152.      standard midi files).
  153. v1.2 to v1.3:
  154.   * handling files/archives containing multiple midi files, writing extra midi 
  155.     files to separate files
  156.   * removes garbage bytes at end of a track (data between end of track and 
  157.     following track)
  158.   * fixed bug: program allowed fixing of midifix.mid itself and destroyed it.
  159.   * Instead of multichannel error correction in version 1 midi files only 
  160.     single warning per track and channels are not changed.
  161. v1.3 to v1.4:
  162.   * added option -tracksonly to repair only track headers 
  163.     (find midi tracks and their real length)
  164.   * fixed a bug that produced a warning about lost bytes where no byte was
  165.     really lost.
  166.   * converting midi files that begin with "SNio" instead of "MThd"
  167.